class FourDigits < Digits

  def self.run(num)
    new(num).in_words
  end
  
  def in_words
    num_mod(1000).zero? ? simple_thousends : complex_thousends
  end
  
  private
  
  attr_reader :num
  
  def initialize(num)
    @num = num
  end
  
  def first_digit
    single_digits(in_array[0].to_i)
  end
  
  def rest_digits
    in_array[1..-1].join.to_i
  end
  
  def rest
    rest_digits < 10 ? single_digits(rest_digits) : Digits.new(rest_digits).in_english
  end
  
  def simple_thousends
    [first_digit, prefix(power_of_ten)].join('-')
  end
  
  def complex_thousends
    [first_digit, prefix(power_of_ten), rest].join('-')
  end
  
end